package com.b2bpsssm.service.impl;

import com.b2bpsssm.common.R;
import com.b2bpsssm.mapper.RunningWaterMapper;
import com.b2bpsssm.pojo.Running_Water;
import com.b2bpsssm.service.RunningWaterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RunningWaterServicelmpl implements RunningWaterService {
    @Autowired
    private RunningWaterMapper runningWaterMapper;

    @Override
    public R queryRunningWaterList(Integer currentPage, Integer pageSize) {
        R r = new R();
        Integer start = (currentPage - 1) * pageSize;//分页第一个参数
        Integer off = pageSize; //分页第二个参数
        //查询后的数据
        List<Running_Water> runningWaters = runningWaterMapper.queryRunningWaterList(start, off);
        r.setCode(200);
        r.setMassage("success");
        r.setData(runningWaters);
        return r;
    }

    //根据单据编号查询具体数据
    @Override
    public R queryRunningWaterByNumber(String running_water_number) {
        R r = new R();
        List<Running_Water> number = runningWaterMapper.queryRunningWaterByNumber(running_water_number);
        r.setMassage("success");
        r.setData(number);
        r.toString();
        r.setCode(200);
        return r;
    }

    @Override
    public R selRunningWaterLikeNumber(Integer currentPage, Integer pageSize, String running_water_trading_hour1, String running_water_trading_hour2, String running_water_no) {
        R r = new R();
        Integer start = (currentPage - 1) * pageSize;//分页第一个参数
        Integer off = pageSize; //分页第二个参数
        List<Running_Water> list = runningWaterMapper.selRunningWaterLikeNumber(start, off, running_water_trading_hour1, running_water_trading_hour2,running_water_no);
        //成功后返回的结果
        r.setCode(200);
        r.setMassage("success");
        r.setData(list);

        return r;
    }
}